{include file="public/toper"/}
<style>
    .table_td {text-align: center;}
    .table_p {height: 20px;}
    .layui-table {width: 50%;margin: 0 auto;text-align: center;}
    .tis {margin-left: 21%;}
</style>

<div class="x-body">
    <table class="layui-table">
        <p class="tis">订单信息</p>
        <tr>
            <td>门店：{$list['sname']}</td>
            <td>订单号：{$list['order_sn']}</td>
        </tr>
        <tr>
            <td>下单用户：{$list['uname']}</td>
            <td>收货信息：{if condition="$list['order_type'] eq 1"}
                快递：{$list['name']},{$list['phone']},{$list['consignee']}
                {else/}
                自提：{$list['sname']},{$list['sphone']},{$list['saddress']}
                {/if}</td>
        </tr><tr>
            <td>下单时间：{$list['add_time']|date="Y-m-d H:i:s",###}</td>
            {if condition="$list['pay_time'] neq ''"}
            <td>支付时间：{if condition="$list['pay_time'] neq ''"}
                            {$list['pay_time']|date="Y-m-d H:i:s",###}
                            {/if}
            </td>
            {/if}
        </tr>
        <tr>
            {if condition="$list['shipping_time'] neq ''"}
            <td>发货时间：{if condition="$list['shipping_time'] neq ''"}
                            {$list['shipping_time']|date="Y-m-d H:i:s",###}
                        {/if}
            </td>
            {/if}
            {if condition="$list['confirm_time'] neq ''"}
            <td>确认时间：{if condition="$list['confirm_time'] neq ''"}
                            {$list['confirm_time']|date="Y-m-d H:i:s",###}
                            {/if}
            </td>
            {/if}
            {if condition="$list['order_type'] eq 2"}
                {if condition="$list['end_time'] neq ''"}
                <td>完结时间：{if condition="$list['end_time'] neq ''"}
                    {$list['end_time']|date="Y-m-d H:i:s",###}
                    {/if}
                </td>
                {/if}
            {/if}
        </tr>
        {if condition="$list['order_type'] eq 1"}
        <tr>
            {if condition="$list['end_time'] neq ''"}
            <td>完结时间：{if condition="$list['end_time'] neq ''"}
                {$list['end_time']|date="Y-m-d H:i:s",###}
                {/if}
            </td>
            {/if}
        </tr>
        {/if}
        <tr>
            <td style="color: #FF0000">订单状态：{if condition="$list['order_status'] eq 0"}
                未支付
                {elseif condition="$list['order_status'] eq 1"/}
                已支付
                {elseif  condition="$list['order_status'] eq 2"/}
                已发货
                {elseif  condition="$list['order_status'] eq 3"/}
                已完成
                {elseif  condition="$list['order_status'] eq 4"/}
                已取消
                {elseif  condition="$list['order_status'] eq 5"/}
                归还中
                {elseif  condition="$list['order_status'] eq 6"/}
                店铺已收货
                {elseif  condition="$list['order_status'] eq 7"/}
                已验收
                {elseif  condition="$list['order_status'] eq 8"/}
                待用户确认
                {elseif  condition="$list['order_status'] eq 9"/}
                待用户支付
                {elseif  condition="$list['order_status'] eq 10"/}
                租赁中
                {/if}
            </td>
            <td>订单类型：{if condition="$list['type'] eq 1"} 会员共享  {elseif  condition="$list['type'] eq 2"/} 销售{/if}</td>
        </tr>
    </table>
    {if condition="$list['order_type'] eq 1"}
    <p class="table_p"></p>
    <table class="layui-table">
        <p class="tis">快递信息</p>
        <tr>
            <td>快递单号</td>
            <td>快递名称</td>
        </tr>
        <tr>
            {if condition="$list['numbers'] eq ''"} <td>无</td>  {else /} <td>{$list['numbers']}</td>{/if}
            {if condition="$list['shipping_name'] eq ''"} <td>无</td>  {else /} <td>{$list['shipping_name']}</td>{/if}
        </tr>
    </table>
    {/if}
    {if condition="$order_pay['pay_channel'] neq ''"}
    <p class="table_p"></p>
    <table class="layui-table">
        <p class="tis">支付信息</p>
        <tr>
            <td>订单类型</td>
            <td>支付渠道</td>
            <td>交易码</td>
            <td>时间</td>
            <td>处理方式</td>
            <td>金额</td>
        </tr>
        <tr>
            <td>{if condition="$order_pay['type'] eq 0"} 购买订单  {elseif condition="$order_pay['type'] eq 1"/} 共享订单  {elseif  condition="$order_pay['type'] eq 2"/}订制订单{/if}</td>

            <td>{$order_pay['pay_channel']}</td>
            <td>{$order_pay['pay_code']}</td>
            <td>{$order_pay['time']|date="Y-m-d H:i:s",###}</td>
            {if condition="$order_pay['pay_mode'] eq 1"} <td>人工</td>  {else /} <td>系统</td>{/if}
            <td>{$order_pay['pay_price']}</td>
        </tr>
    </table>
    {/if}
    <p class="table_p"></p>
    <table class="layui-table">
        <p class="tis">商品信息</p>
        <tr>
            <td>名称</td>
            <td>价格</td>
            <td>数量</td>
            <td>规格</td>
            <td>条形码</td>
        </tr>
        {volist name="list['goods']" id="vo"}
        <tr>
            <td>{$vo['sname']}</td>
            <td>{$vo['goods_price']}</td>
            <td>{$vo['goods_number']}</td>
            {if condition="$vo['spec_item_key'] eq '0'"}
            <td>无</td>
            {else/}
            <td>{$vo['spec_item_key']}</td>
            {/if}
            <td>{$vo['barcodes']}</td>
        </tr>
        {/volist}
    </table>
    <p class="table_p"></p>
    <p class="tis">商品总价：￥{$list['goods_price']}</p>
    <p class="tis">支付价格：￥{$list['pay_price']}</p>

    {if condition="$list['type'] eq 1"}
    <p class="table_p"></p>
    <table class="layui-table">
        <p class="tis">共享信息</p>
        <tr>
            <td>租赁日期：{if condition="$list['lease_time'] neq 0"}{$list['lease_time']|date="Y-m-d",###}{else / }无{/if}</td>
            <td>租赁归还日期：{if condition="$list['lease_end_time'] neq 0"}{$list['lease_end_time']|date="Y-m-d",###}{else / }无{/if}</td>
        </tr>
        {if condition="$list['order_status'] eq 6 ||$list['order_status'] eq 7 ||$list['order_status'] eq 8 || $list['order_status'] eq 9 || $list['order_status'] eq 3"}
        <!--<tr><td>租赁天数：<?php if($list['overdue_number']!=0){echo round(($list['sj']-$list['lease_time'])/3600/24);}else{ echo round(($list['lease_end_time']-$list['lease_time'])/3600/24);}?></td>
        <td>共享期：【{$list['lease_time']|date="Y-m-d",###}到
            {if condition = "$list.overdue_number  neq 0"}
            {$list['sj']|date="Y-m-d",###}
            {else /}
            {$list['lease_end_time']|date="Y-m-d",###}{/if}  】</td>
        </tr>-->
        {/if}
        <tr>
            <td>逾期天数:{$list['overdue_number']}</td>
            <td>减免天数：{$list['reduction_number']}</td>
        </tr>
        <tr>
            <td>逾期费用：{$list['overdue_price']}</td>
            <td>已付押金：{$list['deposit_price']}</td>
        </tr>
        <tr>
            <td>待支付金额：{$list['business_payment_pay']}</td>
            <td>退款金额：{$list['refund_price']}</td>
        </tr>
        <tr>
            <td>磨损说明：{$list['abrasion_explain']}</td>
            <td>磨损金额：{$list['abrasion_price']}</td>
        </tr>
        {if condition = "$list.abrasion_img[0]  neq '0'"}
        <tr><td>磨损照片：</td>
            <td>
                {volist name="$list.abrasion_img" key="key" id="vo"}
                <img width="100" height="100" src="{$vo}" class="thumbs{$key}" thumb="{$vo}" />
                <script>
                    layui.use(['table'], function(){
                        var layer = layui.layer,$ = layui.jquery;

                        var layertips = null;
                        $(document).on('mouseenter','.thumbs'+{$key},function(){
                            //console.log(event);
                            var im = ('<img class="thumb-show" src="'+$(this).attr('thumb')+'" >');
                            var link = $(this).attr('href');
                            //layertip=layer.tips('<img style="" src='"/ >', this, { tips:[2,'#009688'] ,area: ['宽度', '高度'],time:false});
                            layertips = layer.tips( im, this, {
                                tips: [2,'#009688'],
                                skin: 'demo_class',
                                time: false,
                            });
                        });

                        //隐藏缩略图
                        $(document).on('mouseleave','.thumbs'+{$key}, function() {
                            layer.close(layertips);
                        });
                    });
                </script>
                {/volist}
            </td>
        </tr>
        {/if}
    </table>
    {/if}

    <p class="table_p"></p>
        <p class="tis">客服备注</p>
        <form action="" method="post" class="layui-form" id="formc">
            <input type="hidden" name="order_id" value="{$list['order_id']}" class="layui-input">
            <div class="layui-form-item" style="width: 50%;margin: 0 auto;">
                    <input type="text" value="" name="content" required="" lay-verify="required" autocomplete="off"  class="layui-input">
            </div>
            <div class="layui-form-item" style="width: 50%;margin: 0 auto;"><label class="layui-form-label"></label>
                <button  class="layui-btn" lay-filter="formlog" lay-submit="">提交</button>
            </div>
        </form>

    {if condition="!empty($list['service'])"}
    <p class="table_p"></p>
    <table class="layui-table">
        <p class="tis">客服操作</p>
        <tr style="background-color: #f2f2f2;">
            <td>操作内容</td>
            <td>操作时间</td>
            <td>操作人</td>
        </tr>
        {volist name="list['service']" id="vo"}
        <tr>
            <td>{$vo['content']}</td>
            <td>{$vo['create_time']|date="Y-m-d H:i:s",###}</td>
            <td>
                {$vo['name']}
            </td>
        </tr>
        {/volist}
    </table>
    {/if}

    {if condition="$list['order_log'][0] neq ''"}
    <p class="table_p"></p>
    <table class="layui-table">
        <p class="tis">订单日志</p>
        <tr style="background-color: #f2f2f2;">
            <td>操作内容</td>
            <td>操作时间</td>
            <td>操作人</td>
        </tr>
        {volist name="list['order_log']" id="vo"}
        <tr>
            <td>{$vo['content']}</td>
            <td>{$vo['create_time']|date="Y-m-d H:i:s",###}</td>
            <td>
            {if condition="$vo['type'] eq 0"}
            用户：{$vo['name']}
            {elseif condition="$vo['type'] eq 1"/}
            商家：{$vo['name']}
            {elseif condition="$vo['type'] eq 2"/}
            平台：{$vo['name']}
            {elseif condition="$vo['type'] eq 3"/}
                系统自动
            {/if}
            </td>
        </tr>
        {/volist}
    </table>
    {/if}
</div>
{include file="public/footer"/}
<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form,layer = layui.layer;

        form.on('submit(formlog)', function(data) {
            var _form = '';
            if ($(this).attr('data-form')) {
                _form = $($(this).attr('data-form'));
            } else {
                _form = $(this).parents('form');
            }

            layer.msg('数据提交中...',{time:500000});
            $.ajax({
                type: "POST",
                url: "{:url('Order/s_log')}",
                data: _form.serialize(),
                success: function(res) {
                    if (res.code == 200) {
                        layer.msg(res.msg, {time: 1000, icon: 1});
                    } else {
                        layer.msg(res.msg, {time: 1000, icon: 2});
                    }
                }
            });
            return false;
        });
    });
</script>